<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        div{
            border: 1px solid  red;
        }
        #div1{
            width: 100px;
            height: 100px;
        }
        #div2{
            width: 50px;
            height: 50px;
        }
        #div3{
            width: 60px;
            height: 60px;
        }


    </style>
</head>
<body>
 <div id="div1">
     div1<div  id="div2"> div2</div>
 </div>
 <a  href="javascript:void(0)" id="s">  删除节点</a>
 <a  href="javascript:void(0)" id="ss">  增加节点</a>
<script>
    var a = document.getElementById("s");
    //获取超链接删除节点标签对象
    a.onclick=function(){
        //绑定事件
        var div1 = document.getElementById("div1");//获取标签div1标签对象
        var div2 = document.getElementById("div2");//获取div2标签对象
        div1.removeChild(div2);//调用node对象中个remove方法将div2标签从div1标签中移除
    }

    var ss = document.getElementById("ss");
     ss.onclick=function () {
         var div1 = document.getElementById("div1");//获取标签div1标签对象
             var div3 = document.createElement("div");
               div3.setAttribute("id","div3");
               div1.appendChild(div3);
     }

</script>

</body>
</html>